# frozen_string_literal: true

class CreateDecisionTableCells < ActiveRecord::Migration[6.0]
  def change
    create_table :decision_table_cells do |t|
      t.integer :decision_table_row_id, null: false,  limit: 8
      t.integer :ordinal,               null: false,  limit: 4
      t.string  :value,                 null: true,   limit: 255
      t.timestamps                      null: false
    end

    add_index :decision_table_cells, %i[ordinal decision_table_row_id], unique: true
    add_foreign_key :decision_table_cells, :decision_table_rows
  end
end
